﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IFClientDLL.MyCalc.Data
{
    public class MyData_ListTicks
    {
        public MyData_ListTicks(MyData_IF data)
        {
            _ListLineTickData = new List<MyData_IF>();
            _OpenPrice = data.NewPrice;
            AddData(data);
        }
        public virtual void AddData(MyData_IF data)
        {
            _ListLineTickData.Add(data);
            _ClosePrice = data.NewPrice;
            _HighPrice = _ListLineTickData.Max(p => p.NewPrice);
            _LowPrice = _ListLineTickData.Min(p => p.NewPrice);
            _TradeVolume = _ListLineTickData.Sum(p => p.DifTradeVolume);
            _Settlement = _ListLineTickData.Sum(p => p.DifSettlementVolume);
        }
        private List<MyData_IF> _ListLineTickData;
        public List<MyData_IF> ListLineTickData { get { return _ListLineTickData; } }
        private decimal _ClosePrice;
        public decimal ClosePrice { get { return _ClosePrice; } }
        private decimal _OpenPrice;
        public decimal OpenPrice { get { return _OpenPrice; } }
        private decimal _HighPrice;
        public decimal HighPrice { get { return _HighPrice; } }
        private decimal _LowPrice;
        public decimal LowPrice { get { return _LowPrice; } }
        private int _TradeVolume;
        public int TradeVolume { get { return _TradeVolume; } }
        private int _Settlement;
        public int Settlement { get { return _Settlement; } }
    }
}
